import time

from flask import Flask
from flask_sqlalchemy import SQLAlchemy

from cn.wubo.route.route import init_app_route
from log import init_app_log

app = Flask(__name__)
app.config.from_object('config.DevelopmentConfig')
init_app_log(app)
app.logger.info('%s 初始化配置和日志完成', time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())))
# engine = create_engine('sqlite:///D:/db.sqlite')
db = SQLAlchemy(app)

db.create_all()
app.logger.info('%s 初始化数据库完成', time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())))
init_app_route(app)
app.logger.info('%s 初始化路由完成', time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())))

if __name__ == '__main__':
    app.run(host='0.0.0.0', port='5000')
